package com.wngz.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wngz.dto.ComputersDto;
import com.wngz.entity.Computers;
import com.wngz.service.ComputersService;
import com.wngz.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/computer")
public class ComputersController {

    @Autowired
    private ComputersService computersService;


    @PostMapping("/query")
    public ResponseResult query(@RequestBody ComputersDto computersDto){
        IPage<Computers> computersIPage = computersService.queryEmployees(computersDto);
        return ResponseResult.success(computersIPage);
    }

    @PostMapping("/update")
    public ResponseResult updateById(@RequestBody Computers computers){
        computersService.update(computers);
        return ResponseResult.success();
    }

    @DeleteMapping("/remove")
    public ResponseResult removeById(Integer id){
        computersService.remove(id);
        return ResponseResult.success();
    }
}
